#ifndef _DICOM_HANDLER_DIR_OP_HANDLER__
#define _DICOM_HANDLER_DIR_OP_HANDLER__

#include "dicom/web_server.h"
#include "dicom/session.h"

namespace dicom {

class DirOpHandler : public HttpHandler {
 public:
  enum DirOpType {
    kDirOp_Create,
    kDirOp_Rename,
    kDirOp_Delete,
    kDirOp_Move,
  };

  DirOpHandler(onion_request* conn, DirOpType op)
      : HttpHandler(conn), op_type_(op) {}

  virtual ~DirOpHandler() {}

  virtual int HandleRequest(onion_request* conn, onion_response* resp);

  virtual const char* GetName() const { return "DirOpHandler"; }

  static void RegisterHandler(WebServer* s);

 private:
  int HandleCreate(onion_request* conn, onion_response* resp,
                   const CredentialPtr& c);
  int HandleRename(onion_request* conn, onion_response* resp,
                   const CredentialPtr& c);
  int HandleDelete(onion_request* conn, onion_response* resp,
                   const CredentialPtr& c);
  int HandleMove(onion_request* conn, onion_response* resp,
                 const CredentialPtr& c);

  DirOpType op_type_;
};
}

#endif  // _DICOM_HANDLER_DIR_OP_HANDLER__
